﻿namespace WMS6.Web.Configuration
{
    using System;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;

    public class DistributionRangeQuery : BasePage
    {
        protected Button btnList;
        protected Button btnSearch;
        protected DropDownList ddlCarrierID;
        protected DropDownList ddlCity;
        protected DropDownList ddlCounties;
        protected DropDownList ddlProvince;
        protected HtmlForm F2570;
        protected HtmlInputHidden hdnActionID;
        protected HtmlHead Head1;
        protected Label lblCarrierID;
        protected Label lblCity;
        protected Label lblCounties;
        protected Label lblProvince;
        protected Label lblReceiptQuery;
        protected HtmlLink mycss;
        protected TextBox txtCarrierID;
        protected TextBox txtCity;
        protected TextBox txtCounties;
        protected TextBox txtProvince;

        protected void btnList_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("DistributionRangeList.aspx?action={0}&from=list", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer("DistributionRangeList.aspx?action=" + base.UrlEncode(this.hdnActionID.Value), false);
        }

        private void LoadDDl()
        {
            base.InitQueryDDL(this.ddlCarrierID, 0);
            base.InitQueryDDL(this.ddlCity, 0);
            base.InitQueryDDL(this.ddlCounties, 0);
            base.InitQueryDDL(this.ddlProvince, 0);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            base.InitPage(this.Page);
            this.LoadDDl();
        }

        public string CarrierID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtCarrierID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtCarrierID.Text.Trim(), this.ddlCarrierID.SelectedValue);
                }
                return "";
            }
        }

        public string City
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtCity.Text.Trim()))
                {
                    return base.GetParamsString(this.txtCity.Text.Trim(), this.ddlCity.SelectedValue);
                }
                return "";
            }
        }

        public string Counties
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtCounties.Text.Trim()))
                {
                    return base.GetParamsString(this.txtCounties.Text.Trim(), this.ddlCounties.SelectedValue);
                }
                return "";
            }
        }

        public string Province
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtProvince.Text.Trim()))
                {
                    return base.GetParamsString(this.txtProvince.Text.Trim(), this.ddlProvince.SelectedValue);
                }
                return "";
            }
        }
    }
}

